#define SIMDE_TEST_ARM_NEON_INSN div

#include "test-neon.h"
#include "../../../simde/arm/neon/div.h"

static int
test_simde_vdiv_f32 (SIMDE_MUNIT_TEST_ARGS) {
  struct {
    simde_float32 a[2];
    simde_float32 b[2];
    simde_float32 r[2];
  } test_vec[] = {
    { { SIMDE_FLOAT32_C(-246.61), SIMDE_FLOAT32_C(-792.20) },
      { SIMDE_FLOAT32_C(747.10), SIMDE_FLOAT32_C(-128.92) },
      { SIMDE_FLOAT32_C(-0.33), SIMDE_FLOAT32_C(6.14) } },
    { { SIMDE_FLOAT32_C(424.59), SIMDE_FLOAT32_C(-797.13) },
      { SIMDE_FLOAT32_C(-210.37), SIMDE_FLOAT32_C(-738.57) },
      { SIMDE_FLOAT32_C(-2.02), SIMDE_FLOAT32_C(1.08) } },
    { { SIMDE_FLOAT32_C(-681.72), SIMDE_FLOAT32_C(541.25) },
      { SIMDE_FLOAT32_C(568.84), SIMDE_FLOAT32_C(-919.64) },
      { SIMDE_FLOAT32_C(-1.20), SIMDE_FLOAT32_C(-0.59) } },
    { { SIMDE_FLOAT32_C(880.97), SIMDE_FLOAT32_C(457.69) },
      { SIMDE_FLOAT32_C(-25.21), SIMDE_FLOAT32_C(-20.82) },
      { SIMDE_FLOAT32_C(-34.95), SIMDE_FLOAT32_C(-21.98) } },
    { { SIMDE_FLOAT32_C(709.87), SIMDE_FLOAT32_C(-254.84) },
      { SIMDE_FLOAT32_C(202.11), SIMDE_FLOAT32_C(-932.42) },
      { SIMDE_FLOAT32_C(3.51), SIMDE_FLOAT32_C(0.27) } },
    { { SIMDE_FLOAT32_C(-421.37), SIMDE_FLOAT32_C(-299.43) },
      { SIMDE_FLOAT32_C(260.81), SIMDE_FLOAT32_C(497.12) },
      { SIMDE_FLOAT32_C(-1.62), SIMDE_FLOAT32_C(-0.60) } },
    { { SIMDE_FLOAT32_C(495.09), SIMDE_FLOAT32_C(-18.59) },
      { SIMDE_FLOAT32_C(-972.83), SIMDE_FLOAT32_C(973.15) },
      { SIMDE_FLOAT32_C(-0.51), SIMDE_FLOAT32_C(-0.02) } },
    { { SIMDE_FLOAT32_C(-968.48), SIMDE_FLOAT32_C(-739.00) },
      { SIMDE_FLOAT32_C(224.68), SIMDE_FLOAT32_C(-500.16) },
      { SIMDE_FLOAT32_C(-4.31), SIMDE_FLOAT32_C(1.48) } },
    { { SIMDE_FLOAT32_C(706.64), SIMDE_FLOAT32_C(440.83) },
      { SIMDE_FLOAT32_C(-697.78), SIMDE_FLOAT32_C(784.30) },
      { SIMDE_FLOAT32_C(-1.01), SIMDE_FLOAT32_C(0.56) } },
    { { SIMDE_FLOAT32_C(171.08), SIMDE_FLOAT32_C(-82.45) },
      { SIMDE_FLOAT32_C(-948.90), SIMDE_FLOAT32_C(-438.40) },
      { SIMDE_FLOAT32_C(-0.18), SIMDE_FLOAT32_C(0.19) } }
  };

  for (size_t i = 0 ; i < (sizeof(test_vec) / sizeof(test_vec[0])) ; i++) {
    simde_float32x2_t a, b, r;

    a = simde_vld1_f32(test_vec[i].a);
    b = simde_vld1_f32(test_vec[i].b);
    r = simde_vdiv_f32(a, b);

    simde_test_arm_neon_assert_equal_f32x2(r, simde_vld1_f32(test_vec[i].r), 1);
  }

  return 0;
}

static int
test_simde_vdivq_f32 (SIMDE_MUNIT_TEST_ARGS) {
  struct {
    simde_float32 a[4];
    simde_float32 b[4];
    simde_float32 r[4];
  } test_vec[] = {
    { { SIMDE_FLOAT32_C(690.14), SIMDE_FLOAT32_C(72.00), SIMDE_FLOAT32_C(-847.46), SIMDE_FLOAT32_C(224.05) },
      { SIMDE_FLOAT32_C(-16.25), SIMDE_FLOAT32_C(-468.95), SIMDE_FLOAT32_C(219.70), SIMDE_FLOAT32_C(-994.83) },
      { SIMDE_FLOAT32_C(-42.46), SIMDE_FLOAT32_C(-0.15), SIMDE_FLOAT32_C(-3.86), SIMDE_FLOAT32_C(-0.23) } },
    { { SIMDE_FLOAT32_C(15.11), SIMDE_FLOAT32_C(-51.64), SIMDE_FLOAT32_C(-267.55), SIMDE_FLOAT32_C(-349.21) },
      { SIMDE_FLOAT32_C(566.36), SIMDE_FLOAT32_C(187.53), SIMDE_FLOAT32_C(-201.93), SIMDE_FLOAT32_C(69.88) },
      { SIMDE_FLOAT32_C(0.03), SIMDE_FLOAT32_C(-0.28), SIMDE_FLOAT32_C(1.32), SIMDE_FLOAT32_C(-5.00) } },
    { { SIMDE_FLOAT32_C(-421.47), SIMDE_FLOAT32_C(252.11), SIMDE_FLOAT32_C(-360.83), SIMDE_FLOAT32_C(201.92) },
      { SIMDE_FLOAT32_C(666.79), SIMDE_FLOAT32_C(-509.75), SIMDE_FLOAT32_C(-218.04), SIMDE_FLOAT32_C(759.52) },
      { SIMDE_FLOAT32_C(-0.63), SIMDE_FLOAT32_C(-0.49), SIMDE_FLOAT32_C(1.65), SIMDE_FLOAT32_C(0.27) } },
    { { SIMDE_FLOAT32_C(-613.29), SIMDE_FLOAT32_C(-320.60), SIMDE_FLOAT32_C(854.70), SIMDE_FLOAT32_C(623.67) },
      { SIMDE_FLOAT32_C(150.20), SIMDE_FLOAT32_C(965.65), SIMDE_FLOAT32_C(-80.16), SIMDE_FLOAT32_C(-415.88) },
      { SIMDE_FLOAT32_C(-4.08), SIMDE_FLOAT32_C(-0.33), SIMDE_FLOAT32_C(-10.66), SIMDE_FLOAT32_C(-1.50) } },
    { { SIMDE_FLOAT32_C(-251.13), SIMDE_FLOAT32_C(405.25), SIMDE_FLOAT32_C(-400.23), SIMDE_FLOAT32_C(772.23) },
      { SIMDE_FLOAT32_C(-781.87), SIMDE_FLOAT32_C(724.61), SIMDE_FLOAT32_C(517.90), SIMDE_FLOAT32_C(245.11) },
      { SIMDE_FLOAT32_C(0.32), SIMDE_FLOAT32_C(0.56), SIMDE_FLOAT32_C(-0.77), SIMDE_FLOAT32_C(3.15) } },
    { { SIMDE_FLOAT32_C(-107.85), SIMDE_FLOAT32_C(-479.61), SIMDE_FLOAT32_C(-32.07), SIMDE_FLOAT32_C(-586.53) },
      { SIMDE_FLOAT32_C(421.93), SIMDE_FLOAT32_C(-304.44), SIMDE_FLOAT32_C(327.16), SIMDE_FLOAT32_C(559.89) },
      { SIMDE_FLOAT32_C(-0.26), SIMDE_FLOAT32_C(1.58), SIMDE_FLOAT32_C(-0.10), SIMDE_FLOAT32_C(-1.05) } },
    { { SIMDE_FLOAT32_C(-209.46), SIMDE_FLOAT32_C(4.97), SIMDE_FLOAT32_C(904.66), SIMDE_FLOAT32_C(-360.68) },
      { SIMDE_FLOAT32_C(61.47), SIMDE_FLOAT32_C(-621.09), SIMDE_FLOAT32_C(221.91), SIMDE_FLOAT32_C(745.82) },
      { SIMDE_FLOAT32_C(-3.41), SIMDE_FLOAT32_C(-0.01), SIMDE_FLOAT32_C(4.08), SIMDE_FLOAT32_C(-0.48) } },
    { { SIMDE_FLOAT32_C(-816.44), SIMDE_FLOAT32_C(-202.10), SIMDE_FLOAT32_C(-276.32), SIMDE_FLOAT32_C(-588.56) },
      { SIMDE_FLOAT32_C(-218.16), SIMDE_FLOAT32_C(-289.94), SIMDE_FLOAT32_C(-932.73), SIMDE_FLOAT32_C(498.04) },
      { SIMDE_FLOAT32_C(3.74), SIMDE_FLOAT32_C(0.70), SIMDE_FLOAT32_C(0.30), SIMDE_FLOAT32_C(-1.18) } },
    { { SIMDE_FLOAT32_C(231.50), SIMDE_FLOAT32_C(9.60), SIMDE_FLOAT32_C(-307.81), SIMDE_FLOAT32_C(581.74) },
      { SIMDE_FLOAT32_C(-886.78), SIMDE_FLOAT32_C(-210.27), SIMDE_FLOAT32_C(-522.74), SIMDE_FLOAT32_C(-495.13) },
      { SIMDE_FLOAT32_C(-0.26), SIMDE_FLOAT32_C(-0.05), SIMDE_FLOAT32_C(0.59), SIMDE_FLOAT32_C(-1.17) } },
    { { SIMDE_FLOAT32_C(-173.84), SIMDE_FLOAT32_C(980.62), SIMDE_FLOAT32_C(-409.94), SIMDE_FLOAT32_C(616.98) },
      { SIMDE_FLOAT32_C(152.98), SIMDE_FLOAT32_C(820.61), SIMDE_FLOAT32_C(-490.46), SIMDE_FLOAT32_C(539.45) },
      { SIMDE_FLOAT32_C(-1.14), SIMDE_FLOAT32_C(1.19), SIMDE_FLOAT32_C(0.84), SIMDE_FLOAT32_C(1.14) } }
  };

  for (size_t i = 0 ; i < (sizeof(test_vec) / sizeof(test_vec[0])) ; i++) {
    simde_float32x4_t a, b, r;

    a = simde_vld1q_f32(test_vec[i].a);
    b = simde_vld1q_f32(test_vec[i].b);
    r = simde_vdivq_f32(a, b);

    simde_test_arm_neon_assert_equal_f32x4(r, simde_vld1q_f32(test_vec[i].r), 1);
  }

  return 0;
}

SIMDE_TEST_FUNC_LIST_BEGIN
SIMDE_TEST_FUNC_LIST_ENTRY(vdiv_f32)
SIMDE_TEST_FUNC_LIST_ENTRY(vdivq_f32)
SIMDE_TEST_FUNC_LIST_END

#include "test-neon-footer.h"
